package com.ruoyi.project.wf.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.wf.mapper.WfProcessDefMapper;
import com.ruoyi.project.wf.domain.WfProcessDef;
import com.ruoyi.project.wf.service.IWfProcessDefService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 流程定义Service业务层处理
 *
 * @author XQ.XU
 * @date 2020-03-20
 */
@Service
public class WfProcessDefServiceImpl extends ServiceImpl<WfProcessDefMapper, WfProcessDef> implements IWfProcessDefService
{
    @Autowired
    private WfProcessDefMapper wfProcessDefMapper;

    /**
     * 查询流程定义
     *
     * @param id 流程定义ID
     * @return 流程定义
     */
    @Override
    public WfProcessDef selectWfProcessDefById(String id)
    {
        return wfProcessDefMapper.selectWfProcessDefById(id);
    }

    /**
     * 查询流程定义列表
     *
     * @param wfProcessDef 流程定义
     * @return 流程定义
     */
    @Override
    public List<WfProcessDef> selectWfProcessDefList(WfProcessDef wfProcessDef)
    {
        return wfProcessDefMapper.selectWfProcessDefList(wfProcessDef);
    }

    /**
     * 新增流程定义
     *
     * @param wfProcessDef 流程定义
     * @return 结果
     */
    @Override
    public int insertWfProcessDef(WfProcessDef wfProcessDef)
    {
        wfProcessDef.setCreateTime(DateUtils.getNowDate());
        return wfProcessDefMapper.insertWfProcessDef(wfProcessDef);
    }

    /**
     * 修改流程定义
     *
     * @param wfProcessDef 流程定义
     * @return 结果
     */
    @Override
    public int updateWfProcessDef(WfProcessDef wfProcessDef)
    {
        wfProcessDef.setUpdateTime(DateUtils.getNowDate());
        return wfProcessDefMapper.updateWfProcessDef(wfProcessDef);
    }

    /**
     * 删除流程定义对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteWfProcessDefByIds(String ids)
    {
        return wfProcessDefMapper.deleteWfProcessDefByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除流程定义信息
     *
     * @param id 流程定义ID
     * @return 结果
     */
    @Override
    public int deleteWfProcessDefById(String id)
    {
        return wfProcessDefMapper.deleteWfProcessDefById(id);
    }
}
